<!DOCTYPE type>
<html ng-app="myapp">
	<head>
		<meta charset="utf-8"/>
		<title>anjular测试</title>
		<script src="../js/angular.min.js"></script>			
		<link rel="stylesheet" type="text/css" href="../css/index.css"/>	
	</head>
	<body >		
<!--//		自定义$provide服务-->		
		<div ng-controller="myProvide">
			<span>{{info{'name'}}}</span>
			<span>{{info{'sex'}}}</span>
			<span>{{info{'score'}}}</span>
		</div>
		
		

	</body>	
	<script>
		angular.module("myapp",[],function($provide){
			$provide.factory('$output',function(){
				var stu = {
					name :"张三",
					sex:"男",
					score:"60"
				};
				return stu;
			});
		})
		
		.controller("myProvide",function($scope,$output){
			$scope.info = function(n){
				for (_n in $output){
					if(_n == n){
						return ($output[_n]); 	
					}
				}
			}
		});
		
		
	</script>	
</html>



